package com.wyhello.tube4.util;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class IniReader {

	/**
	 * 
	 * @Title: readValue
	 * 
	 * @Description: 通过绝对路径获取properties文件属性， 根据key读取value
	 * 
	 * @param filePath properties文件绝对路径（包括文件名和后缀）
	 * 
	 * @param key 属性key
	 * 
	 * @return String 返回value
	 */

	public static String readValue(String filePath, String key) {

		Properties props = new Properties();
		InputStream in = null;

		try {
			in = new BufferedInputStream(new FileInputStream(filePath));
			props.load(in);
			String value = props.getProperty(key);
			return value;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			try {
				in.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
